#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#codeby     道长且阻
#email      ydhcui@suliu.net/QQ664284092
#website    http://www.suliu.net

import os
import sys
import traceback
import threading

import util
from SmartQQ import QQapi
from message import QQMessageManage

#初始化
if not os.path.exists(util.getres('res')):
    os.mkdir(util.getres('res'))

USERNAME = int(input("输入QQ号码:"))
PASSWORD = input("输入QQ密码:")
ADMIN_QQ = int(input("请输入管理员QQ号"))

QQ = QQapi(USERNAME,PASSWORD)
QEM= QQMessageManage()
QEM.adminlist.append(ADMIN_QQ)
QEM.QQList[USERNAME]=QQ

#main start ...
try:
    threading.Thread(target=QQ.login).start()
    threading.Thread(target=QEM.init).start()
except Exception as e:
    #threading.Thread(target=QQ.login).start()
    SM = util.SendMail(USERNAME,PASSWORD)
    SM.send(['%s@qq.com'%ADMIN_QQ],str(e),'\n'.join(set(traceback.format_exception(*sys.exc_info()))))
    SM.close()












